package com.example.utils;

/**
 * 正则表达式工具类
 */
public class RegexUtils {

    /**
     * 校验手机号是否合法
     *
     * @param phone
     * @return
     */
    public static boolean isPhoneInvalid(String phone) {
        boolean matches = phone.matches(RegexPatterns.PHONE_REGEX);
        return matches;
    }

    /**
     * 校验邮箱是否合法
     *
     * @param email
     * @return
     */
    public boolean isEmailInvalid(String email) {
        boolean matches = email.matches(RegexPatterns.EMAIL_REGEX);
        return matches;
    }

    /**
     * 校验验证码是否合法
     *
     * @param code
     * @return
     */
    public boolean isCodeInvalid(String code) {
        boolean matches = code.matches(RegexPatterns.VERIFY_CODE_REGEX);
        return matches;
    }
}
